package zheezes.eisp.data.orm;

import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

import zheezes.util.ConstantUtil;
import zheezes.util.DateFormatUtil;


@SuppressWarnings({ "rawtypes", "unchecked" })
public class CollectTask {
	public static final int SOURCE_MANUAL = 0;
	public static final int SOURCE_AUTO = 1;
	
	public static final int VIP_HOUR_FROZEN_TASK = 2;
	public static final int RM_DAILY_FROZEN_TASK = 3;
	public static final int SM_INSTANT_VALUE_TASK = 6;
	public static final int SM_DAILY_FROZEN_TASK = 8;
	public static final int FRZ_DATA_TASK = 20;
	
	public static final int STATUS_QUEUE = 0;
	public static final int STATUS_FINISH = 1;
	
	private static Map<Integer, String> descs = new HashMap<Integer, String>();

	static {
		Collection<Class> types = new HashSet<Class>();
		types.add(Integer.TYPE);
		descs.putAll(ConstantUtil.vmap(CollectTask.class, types, ".*TASK"));
	}
	
	private Integer id;
	private Integer type;
	private Integer mpId;
	private Date dataDate;
	private Integer frozenCycle;
	private Integer totalNum;
	private Integer collectedNum;
	private Date createDate;
	private Date startDate;
	private Date lapseDate;
	private Integer groupId;
	private Integer conId;
	private Date lastRunDate;
	private Integer minRunIntv;
	private Integer runTimes;
	private Integer status;
	private Integer priority;
	private Integer source;
	private Integer collectTimes;
	private Integer maxCommSuccNum;
	private Integer commSuccNum;
	
	public String desc() {
		return descs.get(type);
	}
	
	@Override
	public String toString() {
		return String.format("id:%d, type:%d[%s], date[%s], total[%d], collected[%d]", id, type, desc(), DateFormatUtil.getDateFmt().format(dataDate), totalNum, collectedNum);
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Integer getMpId() {
		return mpId;
	}

	public void setMpId(Integer mpId) {
		this.mpId = mpId;
	}

	public Date getDataDate() {
		return dataDate;
	}

	public void setDataDate(Date dataDate) {
		this.dataDate = dataDate;
	}

	public Integer getFrozenCycle() {
		return frozenCycle;
	}

	public void setFrozenCycle(Integer frozenCycle) {
		this.frozenCycle = frozenCycle;
	}

	public Integer getTotalNum() {
		return totalNum;
	}

	public void setTotalNum(Integer totalNum) {
		this.totalNum = totalNum;
	}

	public Integer getCollectedNum() {
		return collectedNum;
	}

	public void setCollectedNum(Integer collectedNum) {
		this.collectedNum = collectedNum;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}
	
	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getLapseDate() {
		return lapseDate;
	}

	public void setLapseDate(Date laspeDate) {
		this.lapseDate = laspeDate;
	}

	public Integer getGroupId() {
		return groupId;
	}

	public void setGroupId(Integer groupId) {
		this.groupId = groupId;
	}

	public Integer getConId() {
		return conId;
	}

	public void setConId(Integer conId) {
		this.conId = conId;
	}

	public Date getLastRunDate() {
		return lastRunDate;
	}

	public void setLastRunDate(Date lastRunDate) {
		this.lastRunDate = lastRunDate;
	}

	public Integer getMinRunIntv() {
		return minRunIntv;
	}

	public void setMinRunIntv(Integer minRunIntv) {
		this.minRunIntv = minRunIntv;
	}

	public Integer getRunTimes() {
		return runTimes;
	}

	public void setRunTimes(Integer runTimes) {
		this.runTimes = runTimes;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getPriority() {
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public Integer getSource() {
		return source;
	}

	public void setSource(Integer source) {
		this.source = source;
	}

	public Integer getCollectTimes() {
		return collectTimes;
	}

	public void setCollectTimes(Integer collectTimes) {
		this.collectTimes = collectTimes;
	}

	public Integer getMaxCommSuccNum() {
		return maxCommSuccNum;
	}

	public void setMaxCommSuccNum(Integer maxCommSuccNum) {
		this.maxCommSuccNum = maxCommSuccNum;
	}

	public Integer getCommSuccNum() {
		return commSuccNum;
	}

	public void setCommSuccNum(Integer commSuccNum) {
		this.commSuccNum = commSuccNum;
	}
}
